package com.scedu.spring5.service;

import com.scedu.spring5.dao.BookDao;
import com.scedu.spring5.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {
    //注入Dao
    @Autowired
    private BookDao bookDao;

    //添加的方法
    public void addBook(Book book){
        bookDao.add(book);

    }
    //修改的方法
    public void editBook(Book book){
        bookDao.edit(book);

    }

    //删除的方法
    public void delBook(Integer id){
        bookDao.delete(id);

    }
    //查询表记录数的方法
    public Integer findCount(){
        return  bookDao.findCount();

    }
    //查询对象的方法
    public Book findOneBookById(Integer id){
        return  bookDao.findOneBookById(id);

    }
    //按书籍状态查询返回 集合
    public List<Book> findAll(String status){
        return  bookDao.findAll(status);

    }
    //批量添加书籍
    public void batchAddBook(List<Object[]> batchArgs){
          bookDao.batchAddBook(batchArgs);

    }
    //批量修改书籍信息
    public void batchEditBook(List<Object[]> batchArgs){
        bookDao.batchEditBook(batchArgs);

    }
    //批量删除书籍
    public void batchDelBook(List<Object[]> batchArgs){
        bookDao.batchDelBook(batchArgs);

    }
}
